package com.zto.sch.base.normal.validator;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: sch-diy-parent
 * @description:
 * @author: sch
 * @create: 2021-06-30 17:29
 **/
@RestController
@RequestMapping("daily")
public class ValidatorTest {

    @RequestMapping("hello")
    public String hello() {
        return "hello";
    }


    @RequestMapping("testValidateUpdate")
    public RspDTO testValidateUpdate(@RequestBody @Validated(Update.class) UserDTO userDTO) {

        return RspDTO.success("update测试成功");
    }

    @RequestMapping("testValidateCreate")
    public RspDTO testValidateCreate(@RequestBody @Validated(Create.class) UserDTO userDTO) {

        return RspDTO.success("create测试成功");
    }
}
